package com.quanxiaoha.weblog.admin.controller;


import com.quanxiaoha.weblog.admin.model.vo.user.UpdateAdminUserPasswordReqVO;
import com.quanxiaoha.weblog.admin.service.AdminUserService;
import com.quanxiaoha.weblog.common.aspect.ApiOperationLog;

import com.quanxiaoha.weblog.common.utils.R;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin")
@AllArgsConstructor
public class AdminUserController {
    private AdminUserService adminUserService;

    @PostMapping("/password/update")
    @ApiOperationLog(description = "修改用户密码")
    public R updatePassword(@RequestBody @Validated UpdateAdminUserPasswordReqVO updateAdminUserPasswordReqVO) {
        return adminUserService.updatePassword(updateAdminUserPasswordReqVO);
    }

    @PostMapping("/user/info")
    @ApiOperationLog(description = "获取用户信息")
    public R findUserInfo() {
        return adminUserService.findUserInfo();
    }
}
